<template>
  <div>
    <el-card :bordered="false" shadow="never" class="ivu-mt" :body-style="{ padding: 0 }">
      <div class="padding-add">
        <el-form
          ref="userFrom"
          :model="userFrom"
          label-width="80px"
          label-position="right"
          @submit.native.prevent
          inline
        >
          <div class="acea-row search-form" v-if="!collapse">
            <div>
              <el-form-item label="用户昵称:" label-for="searchNick">
                <el-input clearable placeholder="请输入内容" v-model="userFrom.searchNick" class="form_content_width" />
              </el-form-item>
              <el-form-item label="登录手机:" label-for="searchPhone">
                <el-input
                  clearable
                  placeholder="请输入内容"
                  v-model="userFrom.searchPhone"
                  class="form_content_width"
                />
              </el-form-item>
            </div>
            <el-form-item class="search-form-sub">
              <el-button type="primary" @click="userSearchs">搜索</el-button>
              <el-button class="ResetSearch" @click="reset('userFrom')">重置</el-button>
            </el-form-item>
          </div>
        </el-form>
      </div>
    </el-card>
    <el-card :bordered="false" shadow="never" class="ivu-mt mt16" :body-style="{ padding: '0 20px 20px' }">
      <el-tabs v-model="userFrom.user_type" @tab-click="onClickTab">
        <el-tab-pane :label="item.name" :name="item.type" v-for="(item, index) in headeNum" :key="index" />
      </el-tabs>
      <el-table
        :data="userLists"
        class="mt16"
        ref="table"
        highlight-current-row
        v-loading="loading"
        empty-text="暂无数据"
        no-filtered-userFrom-text="暂无筛选结果"
        @sort-change="sortChanged"
        @select="handleSelectRow"
        @select-all="handleSelectAll"
      >
        <el-table-column label="ID" min-width="35">
          <template slot-scope="scope">
            <span>{{ scope.row.id }}</span>
          </template>
        </el-table-column>
        <el-table-column label="UID" min-width="50">
          <template slot-scope="scope">
            <span>{{ scope.row.user_id }}</span>
          </template>
        </el-table-column>
        <el-table-column label="用户昵称" min-width="60">
          <template slot-scope="scope">
            <div>{{ scope.row.user_nick }}</div>
          </template>
        </el-table-column>
        <el-table-column prop="user_phone" label="登录手机" v-if="userFrom.originSite == 'cn'"></el-table-column>
        <el-table-column prop="user_email" label="登录邮箱" v-if="userFrom.originSite == 'com'"></el-table-column>
        <el-table-column label="行为类型">
          <template slot-scope="scope">{{ scope.row.type == 1 ? '关注' : '收藏' }}</template>
        </el-table-column>
        <el-table-column prop="message" label="商家名称" width="300" v-if="search_type == 1">
          <template slot-scope="scope">
            <div class="scrollable-cell">{{ scope.row.name }}</div>
          </template>
        </el-table-column>
        <el-table-column prop="message" label="产品名称" width="300" v-else>
          <template slot-scope="scope">
            <div class="scrollable-cell">{{ scope.row.name }}</div>
          </template>
        </el-table-column>
        <el-table-column prop="create_time" label="操作时间" width="180" fixed="right"></el-table-column>
      </el-table>
      <div class="acea-row row-right page">
        <pagination
          v-if="total"
          :total="total"
          :page.sync="userFrom.page"
          :limit.sync="userFrom.limit"
          @pagination="pageChange"
        />
      </div>
    </el-card>
  </div>
</template>
<script>
import {
  getShopAuth,
  getProvinceFn,
  getUserAssets,
  getPlatformNotifyEmail,
  getUserGuestbook,
  getUserViewLog,
  UserTrackingLog,
  getUserTrackingLog,
  getUserActionLog,
} from '@/api/all';
export default {
  name: '',
  components: {},
  data() {
    let self = this;
    return {
      userFrom: {
        searchPhone: '',
        searchNick: '',
        page: 1,
        limit: 10,
        originSite: 'cn',
        searchEmail: '',
        adminId: '',
      },
      options: [], //跟踪人
      collapse: false,
      selectLabelShow: false,
      selectDataLabel: [],
      address: '',
      headeNum: [
        { type: '', name: '国内' },
        { type: 'routine', name: '国外' },
      ],
      userLists: [],
      targetTypes: {
        0: '其他',
        1: '用户',
        2: '店铺',
        3: '产品',
      },
      total: 0,
      options: [
        {
          value: '-1',
          label: '全部',
        },
        {
          value: '0',
          label: '其他',
        },
        {
          value: '1',
          label: '设备',
        },
        {
          value: '2',
          label: '纺织',
        },
      ],
      search_type: 1, //类型：-1 全部，1=关注，2=收藏
    };
  },
  watch: {},
  computed: {},
  async created() {
    const res = await getUserActionLog({
      size: 10,
      search_type: 1,
      origin_site: 'cn',
      user_id: 0,
    });
    this.userLists = res.data.data;
    this.total = res.data.total;
  },
  mounted() {},
  methods: {
    openSelectLabel() {
      this.selectLabelShow = true;
    },

    async provinceFn(pid) {
      const res = await getProvinceFn({ pid: pid });
      return res.data;
    },

    //地址选择
    handleChange(label) {
      this.address = label;
      console.log(this.address);
    },

    userSearchs() {
      console.log(this.userFrom);
    },
    reset() {
      this.userFrom = {
        userName: '',
        userEmail: '',
        userPhone: '',
        dateTime: '',
        nickName: '',
      };
    },
    pageChange() {},
  },
};
</script>
<style scoped lang="scss">
::v-deep .el-tabs__item {
  height: 54px !important;
  line-height: 54px !important;
}
.picBox {
  display: inline-block;
  cursor: pointer;

  .upLoad {
    width: 58px;
    height: 58px;
    line-height: 58px;
    border: 1px dotted rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.02);
    font-size: 24px;
    font-weight: 500;
  }

  .pictrue {
    width: 60px;
    height: 60px;
    border: 1px dotted rgba(0, 0, 0, 0.1);
    margin-right: 10px;

    img {
      width: 100%;
      height: 100%;
    }
  }
}
.el-card,
.el-message {
  overflow: visible !important;
}
.userFrom {
  ::v-deep .ivu-form-item-content {
    margin-left: 0px !important;
  }
}

.userAlert {
  margin-top: 20px;
}

.userI {
  color: var(--prev-color-primary);
  font-style: normal;
}

img {
  height: 36px;
  display: block;
}

.tabBox2_img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;

  img {
    width: 100%;
    height: 100%;
  }
}
.tabBox_img-box {
  display: flex;
}
.tabBox_img {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  cursor: pointer;

  img {
    width: 100%;
    height: 100%;
  }
}

.tabBox_tit {
  width: 60%;
  font-size: 12px !important;
  margin: 0 2px 0 10px;
  letter-spacing: 1px;
  padding: 5px 0;
  box-sizing: border-box;
}

.modelBox {
  ::v-deep .ivu-modal-body {
    padding: 0 16px 16px 16px !important;
  }
}

.vipName {
  color: #dab176;
}

.listbox {
  ::v-deep .ivu-divider-horizontal {
    margin: 0 !important;
  }
}

.labelInput {
  width: 250px;
  border: 1px solid #dcdee2;
  padding: 0 15px;
  border-radius: 5px;
  min-height: 30px;
  cursor: pointer;
  font-size: 12px;
  .span {
    color: #c5c8ce;
  }

  .ivu-icon-ios-arrow-down {
    font-size: 14px;
    color: #808695;
  }
}

.demo-drawer-footer {
  width: 100%;
  position: absolute;
  bottom: 0;
  left: 0;
  border-top: 1px solid #e8e8e8;
  padding: 10px 16px;
  text-align: right;
  background: #fff;
}
.search-form {
  display: flex;
  justify-content: space-between;
  .search-form-box {
    display: flex;
    flex-wrap: wrap;
    flex: 1;
  }
}
.search-form-sub {
  display: flex;
}
</style>

